﻿using System;
using System.Windows;
using System.Windows.Media.Imaging;

namespace PhoobearLibs.Media.Imaging
{
    public static class BitmapExtension
    {
        public static BitmapSource Convert(this System.Drawing.Bitmap source)
        {
            return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(source.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty,
                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
        }
    }
}
